package lcr;

public class Test0088 {
}

class Solution0088_1 {
    public int minCostClimbingStairs(int[] cost) {
        int pre1=cost[0],pre2=cost[1];

        int length = cost.length;
        for (int i = 2; i < length; i++) {
            int temp = pre2;
            pre2 = cost[i] + Math.min(pre1, pre2);
            pre1=temp;
        }

        return Math.min(pre1,pre2);
    }
}
